package com.test.springboot_test.stringTest;

public class StringTest6 {
    public static void main(String[] args) {

        /**
         * 字符串的基本操作
         * 1.字符串的截取
         * 2.字符串的拼接
         * 3.字符串的索引，匹配从前往后
         * 4.字符串的索引，匹配从后往前
         * 5.字母从大到小，字符串切换
         * 6.字母从小到大，字符串切换
         */
        //1.字符串的截取、字符串的索引

        String str = "1+1=@2";
        System.out.println(str.substring(0, str.lastIndexOf("@")));
        System.out.println(str.substring(str.lastIndexOf("@") + 1));

        //2.字符串的拼接

        String str2[] ={"1","2","3"};
        StringBuilder builder = new StringBuilder();
        for (String a : str2){
            builder.append(a);
        }
        System.out.println(builder.toString());
        System.out.println(new String(builder));






    }

}
